Home:ALL Converter>Parse Karma-Coverage | Istanbul report

Parse Karma-Coverage | Istanbul report

Ask Time:2013-12-05T00:09:37         Author:user2871401

Json Formatter

I have a JavaScript file that generates a code-coverage report via karma-coverage. Karma-coverage generates reports via Istanbul from my understanding. At this time, istanbul generates two files of interest: an html report, and a .json file.

The HTML report has percentages around statement coverage, branch coverage, function coverage, and line coverage. A sample of the HTML report can be seen here: http://gotwarlost.github.io/istanbul/public/coverage/lcov-report/index.html

The .json file gets generated in a file called coverage.json. A sample of the coverage.json file can bee seen here: http://gotwarlost.github.io/istanbul/public/coverage/coverage.json.

For the life of me, I can't figure how the HTML report gets the statement, coverage, branch and function coverage percentages from the .json file. However, I to get the statement, coverage, branch, and function coverage percentages from the .json file.

Am I misunderstanding what the .json file is? Isn't there just a summarization in the .json file?

Author:user2871401,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/20380263/parse-karma-coverage-istanbul-report
yy